package com.cn.dao;

/**
 * FUN: sql listener 
 * 
 * @author sushy
 * @date 2016-3-25
 */
public final class SqlWatch {

	private long startTime;
	private long stopTime;
	private boolean isError;
	private String errorMsg;// 错误信息

	public SqlWatch() {
		this.startTime = -1;
		this.stopTime = -1;
		this.isError = false;
	}

	public void start() {
		this.stopTime = -1L;
		this.startTime = System.currentTimeMillis();
	}

	public void stop() {
		this.stopTime = System.currentTimeMillis();
	}

	public long getTime() {
		return this.stopTime - this.startTime;
	}

	public boolean isError() {
		return this.isError;
	}

	public void setError(String errorMsg) {
		this.isError = true;
		this.errorMsg = errorMsg;
	}

	public String getErrorMsg() {
		return this.errorMsg;
	}

}
